import { defineStore } from 'pinia'
import { getEntireDepartments, getEntireRoles } from '../../service/main/main'

interface ImainState {
  entireRoles: any[]
  entireDepartments: any[]
}

export const useMainStore = defineStore('main', {
  state: (): ImainState => ({
    entireRoles: [],
    entireDepartments: []
  }),
  actions: {
    async fetchEntireDataAction() {
      const rolesResult = await getEntireRoles()
      const departmentResult = await getEntireDepartments()

      this.entireRoles = rolesResult.data.list
      this.entireDepartments = departmentResult.data.list
    }
  }
})
